package com.onehouse.domain.checkIn.model.entity;

import com.onehouse.domain.checkIn.model.valobj.CheckInStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CheckInRooms {

    private String checkInRoomsId;    //入住单
    private ArrayList<CheckInRoom> checkInRoomList; //登记入住一般不会超过8个，采用ArrayList不影响性能
    private CheckInStatus checkInStatus;
    private BigDecimal totalAmount;

    public void caculateTotalAmount() {
        this.totalAmount = BigDecimal.ZERO;
        for (CheckInRoom checkInRoom : checkInRoomList) {
            this.totalAmount = this.totalAmount.add(checkInRoom.getCheckInBill().getTotalAmount());
        }
    }

}
